package com.gc.controller.authServlet;

import com.gc.entity.Manager;
import com.gc.entity.Student;
import com.gc.entity.Teacher;
import com.gc.repository.BookSellerRepository;
import com.gc.repository.ManagerRepository;
import com.gc.repository.StudentRepository;
import com.gc.repository.TeacherRepository;
import com.gc.repository.impl.BookSellerRepositoryImpl;
import com.gc.repository.impl.ManagerRepositoryImpl;
import com.gc.repository.impl.StudentRepositoryImpl;
import com.gc.repository.impl.TeacherRepositoryImpl;
import com.gc.service.LoginService;
import com.gc.service.impl.LoginServiceImpl;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet(name = "SignOut", value = "/SignOut")
public class SignOut extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();

        session.invalidate();

        response.setHeader("refresh", "3;URL=/login.jsp");
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("<h3>已经退出！3秒后返回登录界面</h2>");
    }
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
